﻿<Window x:Class="SuperQuery.ExportResults"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="ExportResults" Height="400" Width="600"
        TextOptions.TextFormattingMode="Display" Icon="Icons/export.ico"
        WindowStartupLocation="CenterScreen" ShowInTaskbar="False" ResizeMode="NoResize">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="2*"/>
        </Grid.ColumnDefinitions>

        <!--Export File-->
        <DockPanel Grid.Row="0" Grid.ColumnSpan="2">
            <TextBlock DockPanel.Dock="Left" KeyboardNavigation.TabIndex="0" Margin="5,8,0,0">Export to file:</TextBlock>
            <Button x:Name="btnBrowse" DockPanel.Dock="Right" KeyboardNavigation.TabIndex="1" Click="btnBrowse_Click">_Browse</Button>
            <TextBox KeyboardNavigation.TabIndex="2" Text="{Binding ExportFile, Mode=TwoWay}" Margin="5"/>
        </DockPanel>

        <!--Database result selection-->
        <DockPanel Grid.Row="1" Grid.Column="0">
            <TextBlock DockPanel.Dock="Top" TextWrapping="Wrap" Margin="5">
                Select the databases result sets you want to export:
            </TextBlock>
            <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Center">
                <Button x:Name="bntSelectAll" KeyboardNavigation.TabIndex="4" Click="bntSelectAll_Click">Select _All</Button>
                <Button x:Name="btnSelectNone" KeyboardNavigation.TabIndex="5" Click="btnSelectNone_Click">Select _None</Button>
            </StackPanel>
            <ListBox x:Name="lstDatabases" DockPanel.Dock="Top" Margin="5, 0, 5, 5"
                     ItemsSource="{Binding AvailableDatabases, Mode=TwoWay}" KeyboardNavigation.TabIndex="3"
                     ItemTemplate="{StaticResource SelectableResultSet}"/>
        </DockPanel>

        <!--Export Options-->
        <StackPanel Grid.Row="1" Grid.Column="1">
            <GroupBox Header="Export Format" Margin="5">
                <StackPanel>
                    <RadioButton x:Name="optCSV" KeyboardNavigation.TabIndex="6" Margin="5">Comma Seperated</RadioButton>
                    <RadioButton x:Name="optTab" KeyboardNavigation.TabIndex="7" Margin="5, 0, 5, 5">Tab Seperated</RadioButton>
                </StackPanel>
            </GroupBox>

            <GroupBox Header="Export Style" Margin="5">
                <StackPanel>
                    <RadioButton x:Name="optSeperateFiles" KeyboardNavigation.TabIndex="8" Margin="5">Export each result set to a seperate file</RadioButton>
                    <RadioButton x:Name="optSameFileHeader" KeyboardNavigation.TabIndex="9" Margin="5, 0, 5, 5">Export to one file seperated by SERVER - DATATABASE header</RadioButton>
                    <RadioButton x:Name="optSameFileNoHeader" KeyboardNavigation.TabIndex="10" Margin="5, 0, 5, 5">Export to one file with a SERVER - DATABASE column, no header</RadioButton>
                    <RadioButton x:Name="optSeperateFilesDatabaseName" KeyboardNavigation.TabIndex="11" Margin="5, 0, 5, 5">
                        <TextBlock TextWrapping="Wrap">
                            Export each result to a seperate file, include database and server name in file name
                        </TextBlock>
                    </RadioButton>
                </StackPanel>
            </GroupBox>
        </StackPanel>

        <!--Dialog Buttons-->
        <DockPanel Grid.Row="2" Grid.ColumnSpan="2" LastChildFill="False">
            <Button x:Name="btnClose" DockPanel.Dock="Right" KeyboardNavigation.TabIndex="14" Click="btnClose_Click">_Close</Button>
            <Button x:Name="btnExportAndClose" DockPanel.Dock="Right" KeyboardNavigation.TabIndex="13" Click="btnExportAndClose_Click">_Export &amp; Close</Button>
            <Button x:Name="btnExport" DockPanel.Dock="Right" KeyboardNavigation.TabIndex="12" Click="btnExport_Click">E_xport</Button>
        </DockPanel>
    </Grid>
</Window>
